const { model, Schema } = require('mongoose')
const BaseModel = require('./baseModel')

const newsSchema = Schema({
  // 资讯标题
  title: String,
  // 作者
  author: String,
  // 标签
  tag: [String],
  // 描述
  desn: String,
  // 正文 富文本(字符串是由html组成的)
  body: String,
  // 访问量 
  click: Number,
  // 封面
  pic: String,
  // 逻辑删除
  isdel: {
    type: Boolean,
    default: false
  }
}, {
  timestamps: true
})

const newsModel = model('News', newsSchema)
class NewsModel extends BaseModel {
  constructor() {
    super(newsModel)
  }
}
module.exports = new NewsModel()